<style type="text/css">
body{background:#eee}
.storelogo img{width:3.2rem;height:3.2rem}
.merchgroup .store-star {padding:0.1rem 0 0.2rem 0;font-size:0.55rem;line-height:1rem}
.merchgroup .store-star img{height:0.66rem}
.star-on,.star-off{position:absolute;top:1rem;left:0;overflow:hidden}
.star-rate {margin-left:3.6rem}
.store-distance{float:right;color:#999}
.store-moneylimit{font-size:0.55rem}
.weui_cell_hd {
    padding: 0.6rem;
	padding-left: 0;
}
.weui_cells_text {padding:0 10px;padding-top:10px}
p {
    margin: 0 0 2px;
}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: 3.6rem;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'main'">
	 <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">确认预约</div>
		<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
		<div class="weui_cells">
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预约项目</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.serve_title">{{pagedata.serve.title}}</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预约套餐</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.package_title">{{pagedata.package.package_title || '默认套餐'}}</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预约时间</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.time">{{pagedata.day.ymd}} {{pagedata.serve_time.times.start}}~{{pagedata.serve_time.times.end}}</div>
        </div>
		<div ng-if="pagedata.post.package_price>0" class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预约费用</span>
                </div>
                <div class="weui_cell_ft" ng-model="pagedata.post.package_price">{{pagedata.post.package_price || '0.00'}}元/人次</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预约人次</span>
                </div>
                <div class="weui_cell_ft">
					<div class="fui-number small">
						<div ng-if="pagedata.post.total>1" class="minus" ng-click="pagedata.minus()"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
						<div ng-if="pagedata.post.total==1" class="minus disabled"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
						<input class="num shownum" type="text" ng-model="pagedata.post.total" style="width:50px" readonly="true"/>
						<div class="plus" ng-click="pagedata.plus()"><i class="icon icon-tianjia" style="font-size:0.7rem"></i></div>
					</div>
				</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>超时取消说明</span>
                </div>
                <div class="weui_cell_ft red"  ng-model="pagedata.post.package_price">订单在{{pagedata.basic.timeout || '5'}}分钟内未支付将自动取消！</div>
        </div>
		</div>
		<div class="weui_cells weui_cells_form">
				<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">联系人</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.username" class="weui_input" type="text" placeholder="请输入联系人">
                </div>
                </div>
				<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">联系电话</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.mobile" value="{{pagedata.post.mobile}}" class="weui_input" type="number" placeholder="请输入电话">
                </div>
                </div>
        </div>
		<div class="weui_cells weui_cells_form">
			<div ng-repeat="item in pagedata.post.fileds">
				<div class="weui_cell" ng-if="item.type == 1">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}内容">
					</div>
				</div>
				<div class="weui_cell" ng-if="item.type == 2">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="number" ng-model="item.data" placeholder="输入{{item.title}}内容">
					</div>
				</div>
				<div class="weui_cell" ng-if="item.type == 3">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="item.data">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(item.data)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-click="up_file(item,'data','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
				</div>
				<div ng-if="item.type == 4" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 4" class="weui_cells weui_cells_radio2">
						<label class="weui_cell weui_check_label dashed" ng-repeat="(key,value) in item.value">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%">{{value}}</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;"  ng-click="item.data=value;">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>	
				<div ng-if="item.type == 5" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 5" class="weui_cells weui_cells_checkbox" style="padding:0.5rem">
						<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem" ng-repeat="(key,value) in item.value">
							<input type="checkbox" ng-click="duoxuans(value,item,'data')" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" value="{{key}}" id="s11"> {{value}}
						</div>
				</div>
				<div ng-if="item.type == 6" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 6" class="weui_cells weui_cells_form">
				<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="item.data" placeholder="请输入{{item.title}}" rows="2"></textarea>
							<div class="weui_textarea_counter"><span>0</span>/118</div>
						</div>
					</div>
				</div>
				<div ng-if="item.type == 7" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 7" class="weui_cells weui_cells_form" ng-init="pagedata.getlocation(item)">
					<div class="weui_cell">
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.province" class="form-control tpl-province">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="item.data.province==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.city" class="form-control tpl-city">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province]" value="{{value}}" ng-selected="item.data.city==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.district" class="form-control tpl-district">
							<option value="" selected="selected">区县</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province][item.data.city]" value="{{value}}" ng-selected="item.data.district==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:28%">
							<select ng-model="item.data.street" class="form-control tpl-district">
							<option value="" selected="selected">街道</option>
							<option ng-repeat="value in pagedata.province[item.data.province][item.data.city][item.data.district]" value="{{value}}" ng-selected="item.data.street==value">{{value}}</option>
							</select>
						</div>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data.xiangxi" placeholder="输入详细地址">
                </div>
				</div>
			</div>
        </div>
		<div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">备注</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="输入备注内容" ng-model="pagedata.post.remark">
                </div>
            </div>
        </div>
		<div ng-if="pagedata.serve.notice" class="weui_cells_text red">
				<div>{{pagedata.serve.notice}}</div>
		</div>
		<div class="fui-navbar order-create-checkout">
			<a ng-if="pagedata.post.totalprice>0" href="javascript:;" class="nav-item total" style="text-align:left;padding-left:0.5rem">
				<span  class="text-danger bigprice">&yen; 
					<span class="totalprice" style="font-size:1.2rem">{{price(pagedata.post.totalprice) || '0.00'}}</span>
				</span>
			</a>
			<a ng-if="!pagedata.order_id && pagedata.post.totalprice>0" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="pagedata.pay_submit(pagedata.post,'jy_yuyue/book/post/','jy_yuyue/order//status=1')" >
				<div class="fee-tagup-nav">
					确认支付
				</div>
			</a>
			<a ng-if="!pagedata.order_id && pagedata.post.totalprice<=0" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="post(pagedata.post,'jy_yuyue/book/post/')" >
				<div class="fee-tagup-nav">
					确认预约
				</div>
			</a>
			<a href="javascript:;" class="nav-item btn btn-danger buybtn" ng-if="pagedata.order_id" ng-click="access_json('jy_yuyue/order/')" >
				<div class="fee-tag-nav">
					查看订单
				</div>
			</a>
		</div>
</div>
</div>
<script type="text/javascript">
if(scope.pagedata.basic && scope.pagedata.basic.dingwei!=1){
if(!scope.main.lat_lng){
	window.scope.location(function(res){
		scope.main.lat_lng=res.lat_lng;
		scope.pagedata.post.address = res.address;
		scope.$evalAsync();
	});
}
}else{
}
scope.pagedata.pay_submit=function(post,post_url,complete_url){
	scope.post_json(post_url,post,function(result){
		if(result.order_id){
			scope.pagedata.order_id=result.order_id;
			scope.$evalAsync();
			scope.tool.pay(result.pay_id,function(res){
					if(res.type=='success'){
						scope.message('支付成功！','success',complete_url);
					}else{
						scope.message('支付失败！','success',complete_url);
					}
			},'','',complete_url);
		}
	});
}
//减少
scope.pagedata.minus=function(){
	if(scope.pagedata.basic.yuyue_num<=1){
		scope.message('最少预约1人次！','error');
		return false;
	}
	scope.pagedata.post.total--
	scope.pagedata.refresh();
}
//增加
scope.pagedata.plus=function(){
	scope.pagedata.basic.yuyue_num=scope.pagedata.basic.yuyue_num?scope.pagedata.basic.yuyue_num:1;
	if(scope.pagedata.basic.yuyue_num<=scope.pagedata.post.total){
		scope.message('最多可以预约'+scope.pagedata.basic.yuyue_num+'人次','error');
		return false;
	}
	scope.pagedata.post.total++
	scope.pagedata.refresh();
}
//刷新总数和总价
scope.pagedata.refresh=function(){
	var total=0,totalprice=0.00;
	totalprice=scope.pagedata.post.total*scope.pagedata.post.package_price
	totalprice = totalprice.toString(); //将数字转换为字符串
	var pos_decimal = totalprice.indexOf('.'); //小数点的索引值
	 // 当整数时，pos_decimal=-1 自动补0  
	if (pos_decimal < 0) {  
			pos_decimal = totalprice.length;  
			totalprice += '.';  
	}

	// 当数字的长度< 小数点索引+2时，补0  
	while (totalprice.length <= pos_decimal + 2) {  
			totalprice += '0';  
	}  
	scope.pagedata.post.totalprice=totalprice;
	scope.$evalAsync();
}
</script>